home *** CD-ROM | disk | FTP | other *** search
/ NeXTSTEP 3.1 (Developer) [x86] / NeXT Step 3.1 Intel dev.cdr.dmg / NextDeveloper / Headers / bsd / dev / SCSIDisk.h < prev    next >
Encoding:
Text File  |  1993-04-30  |  2.8 KB  |  103 lines

  1. /*     Copyright (c) 1991 NeXT Computer, Inc.  All rights reserved. 
  2.  *
  3.  * SCSIDisk.h - Exported Interface for SCSI Disk device class. 
  4.  *
  5.  * HISTORY
  6.  * 11-Feb-91    Doug Mitchell at NeXT
  7.  *      Created. 
  8.  */
  9.  
  10. #import <driverkit/return.h>
  11. #import <driverkit/IODisk.h>
  12. #import <driverkit/scsiTypes.h>
  13. #import <driverkit/generalFuncs.h>
  14.  
  15. /*
  16.  * FIXME - there should only be one thread if target does not 
  17.  * implement command queueing, and more (at least two, max TBD)
  18.  * if target does implement command queueing.
  19.  */
  20. #define NUM_SD_THREADS_MIN    1
  21. #define NUM_SD_THREADS_MAX    6
  22.  
  23. /*
  24.  * This flag forces us to do read-after-write verification (H/W BugTracker
  25.  * entry 1300).
  26.  */
  27. #define RAW_VERIFY        0
  28. #define RAW_BUF_SIZE        (8 * 1024)
  29.  
  30. @interface SCSIDisk:IODisk<IODiskReadingAndWriting,IOPhysicalDiskMethods>
  31. {
  32. @private
  33.     id         _controller;    // the SCSIController object which does
  34.                     // our SCSI transactions
  35.     u_char        _target;    // target/lun of this device
  36.     u_char        _lun;
  37.     unsigned    _isReserved:1,    // we hold a target/lun reservation
  38.             _isRegistered:1; // registered w/IODisk
  39.             
  40.     /*
  41.      * I/O thread info.
  42.      */
  43.     int        _numThreads;
  44.     IOThread    _thread[NUM_SD_THREADS_MAX];
  45.     
  46.     /*
  47.      * The queues on which all I/Os are enqueued by exported methods. 
  48.      */
  49.     queue_head_t    _ioQueueDisk;    // for I/Os requiring disk 
  50.     queue_head_t    _ioQueueNodisk;    // for other I/O
  51.     id         _ioQLock;    // NXConditionLock - protects the 
  52.                     //   ioQueues; I/O thread sleep
  53.                     //   on this.
  54.     unsigned char    _inquiryDeviceType;
  55.     
  56.     /*
  57.      * Eject command locking stuff. A thread about to execute an eject 
  58.      * command must wait until it is the only thread executing a "disk
  59.      * needed" type of I/O before preceeding; other such I/Os will be
  60.      * inhibited by either the ejectPending flag (set by us) or by the
  61.      * lastReadyState instance (maintained by volCheck and set 
  62.      * asynchronously to RS_EJECTING after an I/O thread gets an eject
  63.      * command and calls volCheckEjecting()).
  64.      *
  65.      * Implementation: ejectLock is an NXConditionLock;
  66.      * its condition variable is the number of threads currently 
  67.      * executing commands from IOqueue.q_disk. An eject can only occur
  68.      * when this is 1.
  69.      */
  70.     id        _ejectLock;        
  71.     int        _numDiskIos;    // #of threads executing     
  72.                     // commands from IOqueue.q_disk
  73.     BOOL        _ejectPending;    
  74.     
  75. #if    RAW_VERIFY
  76.     BOOL        _raw_verify;    // enables r-a-w check
  77.     void        *_rawBuffer;    // read-after-write buffer
  78.     unsigned    _rawBufferSize;    // in bytes
  79. #endif    RAW_VERIFY
  80. }
  81.  
  82. + (BOOL)probe : deviceDescription;
  83. + (IODeviceStyle)deviceStyle;
  84. + (Protocol **)requiredProtocols;
  85.  
  86. - (IOReturn) sdCdbRead         : (IOSCSIRequest *)scsiReq
  87.                      buffer:(void *)buffer /* data destination */
  88.                    client:(vm_task_t)client;
  89.               
  90. - (IOReturn) sdCdbWrite        : (IOSCSIRequest *)scsiReq
  91.                      buffer:(void *)buffer /* data destination */
  92.                    client:(vm_task_t)client;
  93.                    
  94. - (int)target;
  95. - (int)lun;
  96. - (unsigned char)inquiryDeviceType;
  97. - controller;
  98.  
  99. @end
  100.  
  101.  
  102.  
  103.